import {createRouter, createWebHashHistory} from "vue-router";
import login from "../views/account/login.vue";
import forgot from "../views/account/forgot.vue";
import password from "../views/user/password.vue";
import index from "../views/index.vue";
import info from "../views/user/info.vue";
import home from "../views/home.vue";
import register from "../views/register.vue";

const routes = [
    {
        path: "/",
        name: "login",
        component: login,
        meta: {
            title: "登录",
        },
    },
    {
        path: "/register",
        name: "register",
        component: register,
        meta: {
            title: "注册",
        },
    },
    {
        path: "/forgot",
        name: "forgot",
        component: forgot,
        meta: {
            title: "忘记密码",
        },
    },
    // 个人中心
    {
        path: "/home",
        name: "home",
        redirect: '/home/index',
        meta: {
            title: "主页",
        },
        component: home,
        children: [
            {
                path: "index",
                name: "index",
                component: index,
                meta: {
                    title: "数据分析",
                },
            },
            {
                path: "info",
                name: "info",
                component: info,
                meta: {
                    title: "个人信息",
                },
            },
            {
                path: "password",
                name: "password",
                component: password,
            },
            {
                path: "forum/table",
                name: "forum_table",
                component: () => import("../views/forum/table.vue"),
                meta: {
                    title: "论坛列表",
                },
            },
            {
                path: "forum/view",
                name: "forum_view",
                component: () => import("../views/forum/view.vue"),
                meta: {
                    title: "论坛详情",
                },
            },
            {
                path: "forum_type/view",
                name: "forum_type_view",
                component: () => import("../views/forum_type/view.vue"),
                meta: {
                    title: "论坛分类详情",
                },
            },
            {
                path: "forum_type/table",
                name: "forum_type_table",
                component: () => import("../views/forum_type/table.vue"),
                meta: {
                    title: "论坛分类列表",
                },
            },
            {
                path: "notice/table",
                name: "notice_table",
                component: () => import("../views/notice/table.vue"),
                meta: {
                    title: "网站公告列表",
                },
            },
            {
                path: "notice/view",
                name: "notice_view",
                component: () => import("../views/notice/view.vue"),
                meta: {
                    title: "网站公告详情",
                },
            },
            {
                path: "comment/table",
                name: "comment_table",
                component: () => import("../views/comment/table.vue"),
                meta: {
                    title: "评论列表",
                },
            },
            {
                path: "comment/view",
                name: "comment_view",
                component: () => import("../views/comment/view.vue"),
                meta: {
                    title: "评论详情",
                },
            },
            {
                path: "goods_type/table",
                name: "goods_type_table",
                component: () => import("../views/goods_type/table.vue"),
                meta: {
                    title: "商品分类列表",
                },
            },
            {
                path: "goods_type/view",
                name: "goods_type_view",
                component: () => import("../views/goods_type/view.vue"),
                meta: {
                    title: "商品分类详情",
                },
            },
            {
              name: "order_table",
              path: "order/table",
              component: () => import("../views/order/table.vue"),
              meta: {
                title: "订单列表",
              },
            },
            {
              name: "order_view",
              path: "order/view",
              component: () => import("../views/order/view.vue"),
              meta: {
                title: "订单详情",
              },
            },
              {
              name: "logistics_delivery_table",
              path: "logistics_delivery/table",
              component: () => import("../views/logistics_delivery/table.vue"),
              meta: {
                title: "订单配送列表",
              },
            },
            {
              name: "logistics_delivery_view",
              path: "logistics_delivery/view",
              component: () => import("../views/logistics_delivery/view.vue"),
              meta: {
                title: "订单配送详情",
              },
            },
                    // 优惠券
            {
              path: 'coupon/table',
              name: 'coupon_table',
              component: () => import('../views/coupon/table.vue'),
              meta: {
                index: 0,
                title: '优惠券列表'
              }
            },
            {
              path: 'coupon/view',
              name: 'coupon_view',
              component: () => import('../views/coupon/view.vue'),
              meta: {
                index: 0,
                title: '优惠券详情'
              }
            },
                    // 会员等级
            {
              path: 'vip_level/table',
              name: 'vip_level_table',
              component: () => import('../views/vip_level/table.vue'),
              meta: {
                index: 0,
                title: '会员等级列表'
              }
            },
            {
              path: 'vip_level/view',
              name: 'vip_level_view',
              component: () => import('../views/vip_level/view.vue'),
              meta: {
                index: 0,
                title: '会员等级详情'
              }
            },
                {
                name: "message_table",
                path: "message/table",
                component: () => import("../views/message/table.vue"),
                meta: {
                    title: "在线留言列表",
                },
            },
            {
                name: "message_view",
                path: "message/view",
                component: () => import("../views/message/view.vue"),
                meta: {
                    title: "在线留言详情",
                },
            },
            {
                name: "exam_table",
                path: "exam/table",
                component: () => import("../views/exam/table.vue"),
                meta: {
                    title: "知识问答",
                },
            },
            {
                name: "exam_view",
                path: "exam/view",
                component: () => import("../views/exam/view.vue"),
                meta: {
                    title: "考试详情",
                },
            },
            {
                name: "exam_question_table",
                path: "exam/question_table",
                component: () => import("../views/exam/question_table.vue"),
                meta: {
                    title: "题库列表",
                },
            },
            {
                name: "exam_question_view",
                path: "exam/question_view",
                component: () => import("../views/exam/question_view.vue"),
                meta: {
                    title: "题库详情",
                },
            },
            {
                name: "exam_answer_view",
                path: "exam/answer_view",
                component: () => import("../views/exam/answer_view.vue"),
                meta: {
                    title: "答题",
                },
            },
            {
              name: "exam_score_table",
              path: "exam/score_table",
              component: () =>
                      import("../views/exam/score_table.vue"),
              meta: {
                title: "评分列表",
              },
            },
            {
              name: "exam_score_view",
              path: "exam/score_view",
              component: () =>
                      import("../views/exam/score_view.vue"),
              meta: {
                title: "评分详情",
              },
            },
            {
              name: "exam_subject_exams_table",
              path: "exam_subject/exams_table",
              component: () => import("../views/exam_subject/exams_table.vue"),
              meta: {
                title: "在线考试",
              },
            },
            {
              name: "exam_subject_genQuestion",
              path: "exam_subject/genQuestion",
              component: () => import("../views/exam_subject/genQuestion.vue"),
              meta: {
                title: "自动题库",
              },
            },
            {
              name: "exam_subject_exams_view",
              path: "exam_subject/exams_view",
              component: () => import("../views/exam_subject/exams_view.vue"),
              meta: {
                title: "考试详情",
              },
            },
            {
              name: "exam_subject_table",
              path: "exam_subject/table",
              component: () => import("../views/exam_subject/table.vue"),
              meta: {
                title: "科目列表",
              },
            },
            {
              name: "exam_subject_view",
              path: "exam_subject/view",
              component: () => import("../views/exam_subject/view.vue"),
              meta: {
                title: "科目详情",
              },
            },
            {
              name: "exam_subject_exams_db",
              path: "exam_subject/exams_db",
              component: () => import("../views/exam_subject/exams_db.vue"),
              meta: {
                title: "试题库",
              },
            },
            {
              name: "exam_subject_wrong_list",
              path: "exam_subject/wrong_list",
              component: () => import("../views/exam_subject/wrong_list.vue"),
              meta: {
                title: "错题记录",
              },
            },
            {
              name: "exam_subject_wrong_view",
              path: "exam_subject/answer_wrong_view",
              component: () => import("../views/exam_subject/answer_wrong_view.vue"),
              meta: {
                title: "错题详情",
              },
            },
            {
              name: "exam_subject_question_table",
              path: "exam_subject/question_table",
              component: () => import("../views/exam_subject/question_table.vue"),
              meta: {
                title: "题库列表",
              },
            },
            {
              name: "exam_subject_question_view",
              path: "exam_subject/question_view",
              component: () => import("../views/exam_subject/question_view.vue"),
              meta: {
                title: "题库详情",
              },
            },
            {
              name: "exam_subject_database_table",
              path: "exam_subject/question_database_table",
              component: () =>
                      import("../views/exam_subject/question_database_table.vue"),
              meta: {
                title: "题库列表",
              },
            },
            {
              name: "exam_subject_database_view",
              path: "exam_subject/question_database_view",
              component: () =>
                      import("../views/exam_subject/question_database_view.vue"),
              meta: {
                title: "题库详情",
              },
            },
            {
              name: "exam_subject_answer_view",
              path: "exam_subject/answer_view",
              component: () => import("../views/exam_subject/answer_view.vue"),
              meta: {
                title: "答题",
              },
            },
            {
              name: "exam_subject_score_table",
              path: "exam_subject/score_table",
              component: () =>
                      import("../views/exam_subject/score_table.vue"),
              meta: {
                title: "评分列表",
              },
            },
            {
              name: "exam_subject_score_view",
              path: "exam_subject/score_view",
              component: () =>
                      import("../views/exam_subject/score_view.vue"),
              meta: {
                title: "评分详情",
              },
            },
              {
                name: "link_table",
                path: "link/table",
                component: () => import("../views/link/table.vue"),
                meta: {
                    title: "链接列表",
                },
            },
            {
                name: "link_view",
                path: "link/view",
                component: () => import("../views/link/view.vue"),
                meta: {
                    title: "链接详情",
                },
            },
              {
              name: "slides_table",
              path: "slides/table",
              component: () => import("../views/slides/table.vue"),
              meta: {
                title: "轮播图列表",
              },
            },
            {
              name: "slides_view",
              path: "slides/view",
              component: () => import("../views/slides/view.vue"),
              meta: {
                title: "轮播图详情",
              },
            },
              {
              path: "article/table",
              name: "article_table",
              component: () => import("../views/article/table.vue"),
              meta: {
                title: "商城资讯列表",
              },
            },
            {
              path: "article/view",
              name: "article_view",
              component: () => import("../views/article/view.vue"),
              meta: {
                title: "商城资讯详情",
              },
            },
            {
              path: "article_type/table",
              name: "article_type_table",
              component: () => import("../views/article_type/table.vue"),
              meta: {
                title: "商城资讯分类列表",
              },
            },
            {
              path: "article_type/view",
              name: "article_type_view",
              component: () => import("../views/article_type/view.vue"),
              meta: {
                title: "商城资讯分类详情",
              },
            },
                {
              name: "sensitive_vocabulary_table",
              path: "sensitive_vocabulary/table",
              component: () => import("../views/sensitive_vocabulary/table.vue"),
              meta: {
                title: "敏感词列表",
              },
            },
            {
              name: "sensitive_vocabulary_view",
              path: "sensitive_vocabulary/view",
              component: () => import("../views/sensitive_vocabulary/view.vue"),
              meta: {
                title: "敏感词详情",
              },
            },
                {
              name: "ad_table",
              path: "ad/table",
              component: () => import("../views/ad/table.vue"),
              meta: {
                title: "广告列表",
              },
            },
            {
              name: "ad_view",
              path: "ad/view",
              component: () => import("../views/ad/view.vue"),
              meta: {
                title: "广告详情",
              },
            },
              {
                name: "auth_table",
                path: "auth/table",
                component: () => import("../views/auth/table.vue"),
                meta: {
                    title: "权限列表",
                },
            },
            {
                name: "auth_view",
                path: "auth/view",
                component: () => import("../views/auth/view.vue"),
                meta: {
                    title: "权限详情",
                },
            },
            {
                name: "user_table",
                path: "user/table",
                component: () => import("../views/user/table.vue"),
                meta: {
                    title: "管理员列表",
                },
            },
            {
                name: "user_view",
                path: "user/view",
                component: () => import("../views/user/view.vue"),
                meta: {
                    title: "管理员详情",
                },
            },
            // 小说
            {
                path: 'novel_chapters/table',
                name: 'novel_chapters_table',
                component: () => import('../views/novel_chapters/table.vue'),
                meta: {
                    index: 0,
                    title: '章节列表'
                }
            },
            {
                path: 'novel_chapters/view',
                name: 'novel_chapters_view',
                component: () => import('../views/novel_chapters/view.vue'),
                meta: {
                    index: 0,
                    title: '章节详情'
                }
            },
            // 注册用户路由
            {
                path: 'registered_user/table',
                name: 'registered_user_table',
                component: () => import('../views/registered_user/table.vue'),
                meta: {
                    index: 0,
                    title: '注册用户列表'
                }
            },
            {
                path: 'registered_user/view',
                name: 'registered_user_view',
                component: () => import('../views/registered_user/view.vue'),
                meta: {
                    index: 0,
                    title: '注册用户详情'
                }
            },
            // 商家用户路由
            {
                path: 'merchant_users/table',
                name: 'merchant_users_table',
                component: () => import('../views/merchant_users/table.vue'),
                meta: {
                    index: 0,
                    title: '商家用户列表'
                }
            },
            {
                path: 'merchant_users/view',
                name: 'merchant_users_view',
                component: () => import('../views/merchant_users/view.vue'),
                meta: {
                    index: 0,
                    title: '商家用户详情'
                }
            },
            // 生鲜商品路由
            {
                path: 'fresh_products/table',
                name: 'fresh_products_table',
                component: () => import('../views/fresh_products/table.vue'),
                meta: {
                    index: 0,
                    title: '生鲜商品列表'
                }
            },
            {
                path: 'fresh_products/view',
                name: 'fresh_products_view',
                component: () => import('../views/fresh_products/view.vue'),
                meta: {
                    index: 0,
                    title: '生鲜商品详情'
                }
            },
            // 分类信息路由
            {
                path: 'classification_information/table',
                name: 'classification_information_table',
                component: () => import('../views/classification_information/table.vue'),
                meta: {
                    index: 0,
                    title: '分类信息列表'
                }
            },
            {
                path: 'classification_information/view',
                name: 'classification_information_view',
                component: () => import('../views/classification_information/view.vue'),
                meta: {
                    index: 0,
                    title: '分类信息详情'
                }
            },
            // 定制商品路由
            {
                path: 'customized_products/table',
                name: 'customized_products_table',
                component: () => import('../views/customized_products/table.vue'),
                meta: {
                    index: 0,
                    title: '定制商品列表'
                }
            },
            {
                path: 'customized_products/view',
                name: 'customized_products_view',
                component: () => import('../views/customized_products/view.vue'),
                meta: {
                    index: 0,
                    title: '定制商品详情'
                }
            },
            // 我要定制路由
            {
                path: 'i_want_to_customize_it/table',
                name: 'i_want_to_customize_it_table',
                component: () => import('../views/i_want_to_customize_it/table.vue'),
                meta: {
                    index: 0,
                    title: '我要定制列表'
                }
            },
            {
                path: 'i_want_to_customize_it/view',
                name: 'i_want_to_customize_it_view',
                component: () => import('../views/i_want_to_customize_it/view.vue'),
                meta: {
                    index: 0,
                    title: '我要定制详情'
                }
            },
            // 影视小说路由
            {
                path: 'film_and_television_novels/table',
                name: 'film_and_television_novels_table',
                component: () => import('../views/film_and_television_novels/table.vue'),
                meta: {
                    index: 0,
                    title: '影视小说列表'
                }
            },
            {
                path: 'film_and_television_novels/view',
                name: 'film_and_television_novels_view',
                component: () => import('../views/film_and_television_novels/view.vue'),
                meta: {
                    index: 0,
                    title: '影视小说详情'
                }
            },
            // 线下活动路由
            {
                path: 'offline_activities/table',
                name: 'offline_activities_table',
                component: () => import('../views/offline_activities/table.vue'),
                meta: {
                    index: 0,
                    title: '线下活动列表'
                }
            },
            {
                path: 'offline_activities/view',
                name: 'offline_activities_view',
                component: () => import('../views/offline_activities/view.vue'),
                meta: {
                    index: 0,
                    title: '线下活动详情'
                }
            },
            // 场次安排路由
            {
                path: 'venue_arrangement/table',
                name: 'venue_arrangement_table',
                component: () => import('../views/venue_arrangement/table.vue'),
                meta: {
                    index: 0,
                    title: '场次安排列表'
                }
            },
            {
                path: 'venue_arrangement/view',
                name: 'venue_arrangement_view',
                component: () => import('../views/venue_arrangement/view.vue'),
                meta: {
                    index: 0,
                    title: '场次安排详情'
                }
            },
            // 座位安排路由
            {
                path: 'seating_arrangement/table',
                name: 'seating_arrangement_table',
                component: () => import('../views/seating_arrangement/table.vue'),
                meta: {
                    index: 0,
                    title: '座位安排列表'
                }
            },
            {
                path: 'seating_arrangement/view',
                name: 'seating_arrangement_view',
                component: () => import('../views/seating_arrangement/view.vue'),
                meta: {
                    index: 0,
                    title: '座位安排详情'
                }
            },
            // 意见反馈路由
            {
                path: 'feedback_on_opinions/table',
                name: 'feedback_on_opinions_table',
                component: () => import('../views/feedback_on_opinions/table.vue'),
                meta: {
                    index: 0,
                    title: '意见反馈列表'
                }
            },
            {
                path: 'feedback_on_opinions/view',
                name: 'feedback_on_opinions_view',
                component: () => import('../views/feedback_on_opinions/view.vue'),
                meta: {
                    index: 0,
                    title: '意见反馈详情'
                }
            },
            // iframe+
            {
                path: 'iframe/recognition_type',
                name: 'iframe_recognition_type',
                component: () => import('../views/iframe/recognition_type.vue'),
                meta: {
                    index: 0,
                    title: '智能识别系统'
                }
            },
            {
                path: 'iframe/translate',
                name: 'iframe_translate',
                component: () => import('../views/iframe/translate.vue'),
                meta: {
                    index: 0,
                    title: '在线智能翻译'
                }
            },
            {
                path: 'iframe/iframe',
                name: 'iframe_iframe',
                component: () => import('../views/iframe/iframe.vue'),
                meta: {
                    index: 0,
                    title: '天气预报'
                }
            },
        ],
    },
];
const router = createRouter({
    history: createWebHashHistory(),
    routes,
    scrollBehavior(to, from, savedPosition) {
        // 滚动到顶部
        return {top: 0}
    }
});

router.afterEach((to, from, next) => {
    let title = "样式开发测试测试测试测试单-admin";
    document.title = title;
})


export default router;
